package com.flython.aems.management.component;

import com.flython.aems.management.model.ProfileParam;
import com.flython.aems.management.repo.ProfileRepo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProfileParamSupplier extends AbstractParamsSupplier<ProfileParam> {

    @Autowired
    ProfileRepo profileRepo;

    public ProfileParamSupplier(int priority) {
        super(priority);
    }

    @Override
    public Map<String, ProfileParam> selectByNeId(Long neId) {
        List<ProfileParam> params = profileRepo.findByNeId(neId);
        HashMap<String, ProfileParam> map = new HashMap<>();
        params.forEach(p-> map.put(p.getName(),p));
        return map;
    }
}
